#### Replication Code for:
#### Constituency Service and Electoral Accountability in Autocratic Legislatures
#### Author: Erin York
#### Created: 5/30/2024

# this code replicates most data-generated figures and tables in the supplementary appendix
# for figure A4 and Table A15, see alternate file XX

rm(list = ls())

## Load Packages
library(tidyverse)
library(stargazer)
library(xtable)
library(vdemdata)
# if you do not have the vdemdata package installed, you can uncomment the following lines of code:
#install.packages("devtools")
#devtools::install_github("vdeminstitute/vdemdata")
library(MASS)

library(logr)

options("logr.autolog" = TRUE)

# Open the log
lf <- log_open(file.path("logsupplementary.log"))

# Send message to log
log_code()



# load data ---------------------------------------------------------------


# load cross-national dataset
country_panel<- read_csv("df_country_panel.csv")
# load subnational data
# politician level
mpdat<- read_csv("df_mplevel.csv")
# query level
querydat<- read_csv("df_querylevel.csv")
# party-circonscription level
partycirc<- read_csv("df_partylevel.csv")
# party-municipality level
munidat<- read_csv("df_munilevel.csv")




## helper functions ------------------------------------------------------------

# for cluster bootstrapping
block_bs <- function(clust, dat, model){
  nclust <- length(unique(clust))
  levels <- unique(clust)
  samp <- as.vector(sample(levels, size = nclust, replace = T))
  orig <- clust
  dat2 <- plyr::ldply(lapply(samp, FUN = function(x){dat[orig == x,]}), data.frame)
  a <- lm(as.formula(model), data = dat2)
  return(c(coef(a)))
}

# for cluster bootstrapping - negative binomial
block_bs_nb <- function(){
  nclust <- length(unique(mpdat$partyid))
  levels <- unique(mpdat$partyid)
  samp <- as.vector(sample(levels, size = nclust, replace = T))
  orig <- mpdat$partyid
  dat <- plyr::ldply(lapply(samp, FUN = function(x){mpdat[orig == x,]}), data.frame)
  a <- glm.nb(nwrit ~ royalist, data = dat, init.theta = 0.4284)
  b <- glm.nb(nwrit ~ royalist + leader + natlist +
                former + actif, data = dat, init.theta = 0.4509)
  c <- glm.nb(nwrit ~ royalist + gov_full + leader + female + youth +
                former + actif, data = dat, init.theta = 0.4712)
  return(c(coef(a)[1:2], coef(b)[1:6], coef(c)[1:8]))
}

# figure A1 ---------------------------------------------------------------


## Figure A1
fa1<- country_panel %>%
  filter(gov1seat > 0, execme != "-999", totalseats > 0) %>% 
  mutate(seatsharegov = gov1seat/totalseats,
         seatsharenongov = 1-seatsharegov) %>%
  group_by(year) %>%
  summarise(mu = mean(seatsharegov), cilo = quantile(seatsharegov, .05), cihi = quantile(seatsharegov, .95),
            n = n()) %>%
  ggplot(aes(x = year, y = mu)) + 
  geom_pointrange(aes(ymin = cilo, ymax = cihi), color = "gray", size = .3) + geom_point() +
  theme_bw() + ylim(c(0, 1)) + xlab("") + ylab("Prop. seats held by largest party")
ggsave(fa1, filename = "FigureA1.pdf",
             width = 8, height = 5)


# figure A2 ---------------------------------------------------------------


## Figure A2
fa2<- country_panel %>%
  filter(execme == gov1me, execme != "-999", totalseats > 0) %>% 
  mutate(seatsharegov = gov1seat/totalseats,
         seatsharenongov = 1-seatsharegov) %>%
  group_by(year, v2x_regime) %>%
  summarise(mu = mean(seatsharegov), cilo = quantile(seatsharegov, .05), cihi = quantile(seatsharegov, .95),
            n = n()) %>%
  ggplot(aes(x = year, y = mu, color = as.factor(v2x_regime), shape = as.factor(v2x_regime))) + 
  geom_point() +
  geom_line() +
  scale_color_brewer(palette = "Paired", name = "Regime Type", labels = c("Closed autocracy", "Electoral Autocracy")) +
  scale_shape(name = "Regime Type",  labels = c("Closed autocracy", "Electoral Autocracy")) +
  theme_bw() + ylim(c(0, 1.05)) + xlab("") + ylab("Prop. seats held by ruling party")+
  theme(legend.position = "bottom") +
  geom_smooth()
ggsave(fa2, filename = "FigureA2.pdf",
                      width = 8, height = 5)

# figure A3 ---------------------------------------------------------------


## Figure A3
fa3<- country_panel %>%
  filter(execme == gov1me, execme != "-999", totalseats > 0, e_region_world_2 %in% c(1, 2, 3, 4, 7)) %>% 
  mutate(seatsharegov = gov1seat/totalseats,
         seatsharenongov = 1-seatsharegov) %>%
  group_by(year, e_region_world_2) %>%
  summarise(mu = mean(seatsharegov), cilo = quantile(seatsharegov, .05), cihi = quantile(seatsharegov, .95),
            n = n()) %>%
  filter(n > 2)%>%
  ggplot(aes(x = year, y = mu, color = as.factor(e_region_world_2), shape = as.factor(e_region_world_2))) + 
  geom_line() + geom_point() +
  scale_color_manual(values = c("#D7191C", "#FC8D59", "#FEE08B", "#ABDDA4", "#2B83BA", "#99D594"), 
                     name = "Region", labels = c("Eastern Europe and post-Soviet Union", 
                                                 "Latin America",
                                                 "North Africa and Middle East",
                                                 "Sub-Saharan Africa", "Southeast Asia")) +
  scale_shape(name = "Region", labels = c("Eastern Europe and post-Soviet Union", "Latin America",
                                          "North Africa and Middle East",
                                          "Sub-Saharan Africa", "Southeast Asia")) +
  theme_bw() + ylim(c(0, 1)) + xlab("") + ylab("Prop. seats held by ruling party")+
  theme(legend.position = "bottom") +
  guides(col = guide_legend(nrow = 2))
ggsave(fa3, filename = "FigureA3.pdf",
       width = 8, height = 5)


# figure A4 ---------------------------------------------------------------

## see 04_rep_external.R


# figure A5 ---------------------------------------------------------------


fa5<- partycirc %>%
  filter(opposition == 1) %>%
  group_by(circid) %>%
  summarise(oppvote2011 = sum(voteshare2011),
            oppvote2016 = sum(voteshare2016),
            delta = oppvote2016-oppvote2011) %>%
  ggplot(aes(x = delta)) +
  geom_histogram() + theme_bw() + 
  xlab("District Change in Voteshare 2011-2016 - All Nonroyalist Parties") + 
  ylab("")
ggsave(fa5, filename = "FigureA5.pdf",
       width = 8, height = 5)


# figure A6 ---------------------------------------------------------------

fa6<- querydat %>%
  mutate(Nation =natdum,
         Region = regdum,
         Commune = commdum,
         Georeference = anyplace,
         Casework = casework,
         Complaint = complaint,
         Province = ifelse(provdum + prefdum > 0, 1, 0),
         Royalist = as.numeric(partyid %in% c("RNI", "UC", "PAM", "MP"))) %>%
  dplyr::select(Nation:Royalist) %>%
  group_by(Royalist) %>%
  dplyr::summarise_each(funs(mean)) %>%
  gather(attribute, mn, Nation:Province) %>%
  mutate(attribute = fct_reorder(attribute, mn),
         rounded = round(mn, digits = 2),
         Royalist = plyr::mapvalues(Royalist, from = c(0, 1), to = c("No", "Yes"))) %>%
  ggplot(aes(x = attribute, y = mn, fill = Royalist)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_text(aes(label = rounded, hjust = -.5),position = position_dodge(width=1)) +
  ylim(c(0, 1)) +
  theme_bw() +
  coord_flip() +
  ylab("Proportion of queries with specified content reference") +
  xlab("") +
  scale_fill_manual(values = c("#5cb0e0", "#CA0020")) +
  theme(legend.position = "bottom")
ggsave(fa6, filename = "FigureA6.pdf",
       width = 8, height = 5)

# table A1 ----------------------------------------------------------------

# load vdem package
vdem<- vdem
# generate summary statistics
# note table was formatted by hand
ta1<- vdem %>%
  filter(year %in% c(1995, 2005, 2015) & v2x_regime <= 1) %>% group_by(year) %>% 
  summarise(exec_queries = mean(v2lgqstexp_ord, na.rm = T),
            bill_prop = mean(v2lgintblo, na.rm = T),
            control_funds = mean(v2lgfunds_ord, na.rm = T)) %>%
  t()

sink("TableA1.tex")
print(xtable(ta1))
sink()

# table A2 ----------------------------------------------------------------


## Table A2
m1 <- (lm(seatsharegov ~ v2x_regime + v2lgqstexp_ord  + country_name + factor(year), 
          data = 
            country_panel %>% filter(gov1seat > 0, execme != "-999", totalseats > 0, year >= 1975) %>% 
            mutate(seatsharegov = gov1seat/totalseats,
                   seatsharenongov = 1-seatsharegov) %>%
            mutate(multiparty = as.numeric(v2elmulpar_ord >= 2))))

m2 <- (lm(seatsharegov ~ v2x_regime + v2lgqstexp_ord  +
            v2lgintblo + v2lgfunds_ord + country_name + factor(year), 
          data = 
            country_panel %>% filter(gov1seat > 0, execme != "-999", totalseats > 0, year >= 1975) %>% 
            mutate(seatsharegov = gov1seat/totalseats,
                   seatsharenongov = 1-seatsharegov) %>%
            mutate(multiparty = as.numeric(v2elmulpar_ord >= 2))))

m3 <- (lm(seatsharegov ~ v2x_regime + v2lgqstexp_ord  +
            v2lgintblo + v2lgfunds_ord + log(e_population) + e_migdppcln + country_name + factor(year), 
          data = 
            country_panel %>% filter(gov1seat > 0, execme != "-999", totalseats > 0, year >= 1975) %>% 
            mutate(seatsharegov = gov1seat/totalseats,
                   seatsharenongov = 1-seatsharegov) %>%
            mutate(multiparty = as.numeric(v2elmulpar_ord >= 2))))

sink("TableA2.tex")
stargazer::stargazer(m1, m2, m3,
                     dep.var.labels = c("Largest Party Seatshare"),
                     star.cutoffs = c(0.05, 0.01, 0.001),
                     covariate.labels = c("Electoral Autocracy", "Executive Queries",
                                          "Bill Proposals", "Control of Funds",
                                          "Log Pop.", "Log per cap GDP"),
                     omit = c("Constant", "country*", "year*"),
                     add.lines = list(c("Mean DV",  "0.72", "0.72", "0.72"),
                                      c("Country FEs", rep("\\checkmark", 3)),
                                      c("Year FEs", rep("\\checkmark",3))),
                     omit.stat = c("f", "ser"))
sink()

# table A4 ----------------------------------------------------------------


# generate summary statistics
# note table was formatted by hand
ta4<- querydat %>% group_by(ministry) %>% 
  summarise(n = n(), perc = 100*n/27186) %>%
  filter(n> 300) %>%
  arrange(tolower(ministry))

sink("TableA4.tex")
print(xtable(ta4))
sink()

## table A5 ---------------------------------------------------------------------

sink("TableA5.tex")
mpdat %>% 
  dplyr::select(royalist, gov_full, leader, natlist, female, youth, former, actif, nwrit, log_nwrit) %>%
  data.frame() %>%
  stargazer(summary.stat = c("N", "mean", "sd", "min", "max"),
            covariate.labels = c("Royalist", "Governing Coalition", "Committee Leader",
                                 "National List", "Female", "Youth", "2007 Parliament",
                                 "Civic Engagement", "Written Questions", "Log Written"))
sink()

## table A6 ---------------------------------------------------------------------


sink("TableA6.tex")
partycirc %>% 
  ungroup() %>%
  filter(group_code != "None" & group_code != "Alliance of the center") %>%
  dplyr::select(voteshare2016, voteshare2011, n_wr_ln, nwrit, n_or_ln, 
                noral, npols, (population), internet, unemployment, illiteracy, 
                amazigh_low, urban) %>% as.data.frame() %>% 
  stargazer(summary.stat = c("N", "mean", "sd", "min", "max"),
            covariate.labels = c("Voteshare 2016", "Voteshare 2011",
                                 "Log Written", "No. Written",
                                 "Log Oral", "No. Oral",
                                 "No. District Seats",
                                 "Population", "Internet Access",
                                 "Unemployment", "Illiteracy",
                                 "Amazigh", "Urban"))
sink()


# table A7 ----------------------------------------------------------------


writa <- glm.nb(nwrit ~ royalist, data = mpdat)

writb <- glm.nb(nwrit ~ royalist + leader + natlist +
                  former + actif, data = mpdat)

writc <- glm.nb(nwrit ~ royalist + gov_full + leader + female + youth +
                  former + actif, data = mpdat)

set.seed(123456)
bs <- replicate(n = 1000, expr = block_bs_nb())
se <- apply(bs, MARGIN = 1, FUN = sd, na.rm = T)

sea <- se[1:2]
seb <- se[3:8]
sec <- se[9:16]


sink("TableA7.tex")
stargazer(writa, writb, writc,
          se = list(sea, seb, sec),
          dep.var.labels = "Written Questions",
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant"),
          omit.stat = c("f", "ser"),
          add.lines = list(c("Block Bootstrapped", rep(c("Yes"), 3))),
          covariate.labels = c("Royalist", "Governing Coalition", "Committee Leader",
                               "National List", "Female", "Youth",
                               "2007 Parliament", "Civic Engagement"), no.space = T)
sink()

# table A8 ----------------------------------------------------------------

win3_nonpart<- (lm(voteshare2016 ~ log_nonpart + n_or_ln + npols + voteshare2011 + region + log(population) +
                     internet + unemployment + illiteracy + amazigh_low + urban, 
                   data = partycirc))

win4_nonpart<- (lm(voteshare2016 ~ log_nonpart + n_or_ln + npols + voteshare2011 + factor(circid), 
                   data = partycirc))

win5_nonpart<- (lm(votes2016 ~ log_nonpart + n_or_ln + npols + votes2011 +  region + log(population) +
                     internet + unemployment + illiteracy + amazigh_low + urban, 
                   data = partycirc))

win6_nonpart<- (lm(votes2016 ~ log_nonpart + n_or_ln + npols + votes2011 + factor(circid), 
                   data = partycirc))

sink("TableA8.tex")
stargazer(win3_nonpart, win4_nonpart, win5_nonpart, win6_nonpart,
          dep.var.labels = c("Party Voteshare 2016", "Party Votes 2016"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant", "reg", "circ*",
                   "internet", "unem", "ama", "illit", "population", "urb"),
          covariate.labels = c("Log Written - Partisan", "Log Oral",
                               "No. District Seats Held", "2011 Voteshare",
                               "2011 Votes"),
          add.lines = list(c("Mean DV",  "0.19", "0.19", "12518", "12518"),
                           c("Region FEs", "\\checkmark", "", "\\checkmark", ""),
                           c("Dem. Controls", "\\checkmark", "", "\\checkmark", ""),
                           c("District FEs", "",  "\\checkmark", "", "\\checkmark")),
          omit.stat = c("f", "ser"))
sink()

# table A9 ----------------------------------------------------------------


win3_noint<- (lm(voteshare2016 ~ log_noint + n_or_ln + npols + voteshare2011+ region + log(population) +
                   internet + unemployment + illiteracy +amazigh_low+ urban, data = partycirc))

win4_noint<- (lm(voteshare2016 ~ log_noint + n_or_ln +npols +voteshare2011+  factor(circid) , data = partycirc))

win5_noint<- (lm(votes2016 ~ log_noint + n_or_ln + npols + votes2011 +  region + log(population) +
                   internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

win6_noint<- (lm(votes2016 ~ log_noint + n_or_ln + npols + votes2011 + factor(circid), data = partycirc))

sink("TableA9.tex")
stargazer(win3_noint, win4_noint, win5_noint, win6_noint,
          dep.var.labels = c("Party Voteshare 2016", "Party Votes 2016"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant", "reg", "circ*",
                   "internet", "unem", "ama", "illit", "population", "urb"),
          covariate.labels = c("Log Written - Excl Interior", "Log Oral",
                               "No. District Seats Held", "2011 Voteshare",
                               "2011 Votes"),
          add.lines = list(c("Mean DV",  "0.19", "0.19", "12518", "12518"),
                           c("Region FEs", "\\checkmark", "", "\\checkmark", ""),
                           c("Dem. Controls", "\\checkmark", "", "\\checkmark", ""),
                           c("District FEs", "",  "\\checkmark", "", "\\checkmark")),
          omit.stat = c("f", "ser"))
sink()


# table A10 ---------------------------------------------------------------


gov1 <- (lm(voteshare2016 ~ n_wr_ln + n_or_ln + npols + government + voteshare2011 + region + log(population) +
              internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

gov2 <- (lm(voteshare2016 ~ n_wr_ln + n_or_ln + npols + government + voteshare2011 + factor(circid)  , data = partycirc))

gov3 <- (lm(votes2016 ~ n_wr_ln + n_or_ln + npols + government + votes2011 +  region + log(population) +
              internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

gov4 <- (lm(votes2016 ~ n_wr_ln + n_or_ln + npols + government + votes2011 + factor(circid), data = partycirc))

sink("TableA10.tex")
stargazer(gov1, gov2, gov3, gov4,
          dep.var.labels = c("Party Voteshare 2016", "Party Votes 2016"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant", "reg", "circ*",
                   "internet", "unem", "ama", "illit", "population", "urb"),
          covariate.labels = c("Log Written", "Log Oral",
                               "No. District Seats Held", "In Gov. Coalition",
                               "2011 Voteshare",
                               "2011 Votes"),
          add.lines = list(c("Mean DV",  "0.19", "0.19", "12518", "12518"),
                           c("Region FEs", "\\checkmark", "", "\\checkmark", ""),
                           c("Dem. Controls", "\\checkmark", "", "\\checkmark", ""),
                           c("District FEs", "",  "\\checkmark", "", "\\checkmark")),
          omit.stat = c("f", "ser"))
sink()



# table A11 ---------------------------------------------------------------


govroy1 <- (lm(delta_voteshare ~ n_wr_ln + region + government + log(population) +
                 internet + unemployment + illiteracy + amazigh_low + urban , 
               data = filter(partycirc, royalist == 1)))

govroy2 <- (lm(delta_voteshare ~ n_wr_ln + region + government + log(population) +
                 internet + unemployment + illiteracy + amazigh_low + urban , 
               data = filter(partycirc, royalist == 0)))

govroy3 <- (lm(delta_voteshare ~ n_wr_ln * royalist + region + government +  log(population) +
                 internet + unemployment + illiteracy + amazigh_low + urban, 
               data =partycirc))

govroy4 <- (lm(delta_votes ~ n_wr_ln + region + government + log(population) +
                 internet + unemployment + illiteracy + amazigh_low + urban , 
               data = filter(partycirc, royalist == 1)))

govroy5 <- (lm(delta_votes ~ n_wr_ln + region + government +  log(population) +
                 internet + unemployment + illiteracy + amazigh_low + urban , 
               data = filter(partycirc, royalist == 0)))

govroy6 <- (lm(delta_votes ~ n_wr_ln * royalist + region + government +  log(population) +
                 internet + unemployment + illiteracy + amazigh_low + urban , 
               data = partycirc))

sink("TableA11.tex")
stargazer(govroy1, govroy2, govroy3, govroy4, govroy5, govroy6,
          covariate.labels = c("Log Written", "Royalist", "In Gov. Coalition", "Log Writ*Royalist"),
          omit = c("Constant", "reg", "circ*", "internet", "unem", "ama", "illit", "pop*", "urb"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          dep.var.labels = c("Change in Voteshare 2011-2016", "Change in Votes 2011-2016"),
          no.space = T,
          omit.stat = c("adj.rsq", "f", "ser"),
          add.lines = list(c("Sample", "Royalist", "Opposition", "All", "Royalist", "Opposition", "All"),
                           c("Region FEs", rep("\\checkmark", 6)),
                           c("Dem. Controls", rep("\\checkmark", 6))))
sink()

# table A12 ---------------------------------------------------------------


ans1 <- (lm(voteshare2016 ~ n_ans_ln + n_or_ln +npols + voteshare2011 + region + log(population) +
              internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

ans2<- (lm(voteshare2016 ~ n_ans_ln + n_or_ln + npols + voteshare2011 + factor(circid), data = partycirc))

ans3<- (lm(votes2016 ~ n_ans_ln + n_or_ln + npols + votes2011 +  region + log(population) +
             internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

ans4<- (lm(votes2016 ~ n_ans_ln + n_or_ln + npols + votes2011 + factor(circid), data = partycirc))

sink("TableA12.tex")
stargazer(ans1, ans2, ans3, ans4,
          dep.var.labels = c("Party Voteshare 2016", "Party Votes 2016"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant", "reg", "circ*",
                   "internet", "unem", "ama", "illit", "population", "urb"),
          covariate.labels = c("Log Written (Answered)", "Log Oral",
                               "No. District Seats Held", "2011 Voteshare",
                               "2011 Votes"),
          add.lines = list(c("Mean DV",  "0.19", "0.19", "12518", "12518"),
                           c("Region FEs", "\\checkmark", "", "\\checkmark", ""),
                           c("Dem. Controls", "\\checkmark", "", "\\checkmark", ""),
                           c("District FEs", "",  "\\checkmark", "", "\\checkmark")),
          omit.stat = c("adj.rsq","f", "ser"))
sink()

# table A13 ---------------------------------------------------------------


win_nom <- (lm(win ~ log_nwrit  + log_oral + royalist + leader + former + natlist, 
               data = mpdat %>%
                 filter(anynom == 1)))

win_head <- (lm(win ~ log_nwrit + log_oral + royalist + leader +former + natlist, 
                data = mpdat %>%
                  filter(headnom == 1)))

win_nom_roy <- (lm(win ~log_nwrit * royalist + log_oral + leader + former + natlist , 
                   data = mpdat %>%
                     filter(anynom == 1)))

win_head_roy <- (lm(win ~log_nwrit * royalist +log_oral  + leader +former + natlist, 
                    data = mpdat %>%
                      filter(headnom == 1)))

sink("TableA13.tex")
stargazer(win_nom, win_nom_roy, win_head, win_head_roy,
          covariate.labels = c("Log Written", "Log Oral", "Royalist", "Committee Leader", 
                               "2007 Parliament", "National List",
                               "Log Writ x Royalist"),
          dep.var.labels = c("Re-election"),
          column.labels = c("|Nominated","|Nominated", "|Head of List","|Head of List"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant"),
          add.lines = list(c("Mean Re-election Rate","0.55", "0.55","0.60","0.60")),
          no.space = T,
          title = "Electoral Success in the 2016 Elections",
          omit.stat = c("adj.rsq", "f", "ser"))
sink()

## table 14 --------------------------------------------------------------------

local1 <- (lm(voteshare2016 ~ log_local + n_or_ln + npols + voteshare2011 + region + log(population) +
              internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

local2 <- (lm(voteshare2016 ~ log_local + n_or_ln + npols + voteshare2011 + factor(circid), data = partycirc))


local3 <- (lm(votes2016 ~ log_local + n_or_ln + npols + votes2011 +  region + log(population) +
              internet + unemployment + illiteracy + amazigh_low + urban, data = partycirc))

local4 <- (lm(votes2016 ~ log_local + n_or_ln + npols + votes2011 + factor(circid), data = partycirc))

sink("TableA14.tex")
stargazer(local1, local2, local3, local4,
          dep.var.labels = c("Party Voteshare 2016", "Party Votes 2016"),
          star.cutoffs = c(0.05, 0.01, 0.001),
          omit = c("Constant", "reg", "circ*",
                   "internet", "unem", "ama", "illit", "population", "urb"),
          covariate.labels = c("Log Written (Local Only)", "Log Oral",
                               "No. District Seats Held", "2011 Voteshare",
                               "2011 Votes"),
          add.lines = list(c("Mean DV",  "0.19", "0.19", "12518", "12518"),
                           c("Region FEs", "\\checkmark", "", "\\checkmark", ""),
                           c("Dem. Controls", "\\checkmark", "", "\\checkmark", ""),
                           c("District FEs", "",  "\\checkmark", "", "\\checkmark")),
          omit.stat = c("f", "ser"))
sink()

## table 15 --------------------------------------------------------------------


## see 04_rep_external.R


####

log_close()

